package ooday01;

public class Student {
    String name;       //描述对象的属性
    int age;           //作用：给成员变量赋初始值
    String className;  //语法：与类同名，没有返回值类型（连void都没有）
    String stuId;      //调用：在new对象时自动调用
    Student(){

    }

    Student(String name,int age){
        this.name=name;
        this.age=age;
    }


    Student(String name, int age,String className,String stuId){
        this.name=name;
        this.age=age;
        this.className=className;
        this.stuId=stuId;

    }

    void study(){
        System.out.println(name+"在学习");
    }
    void  sayHi(){
        System.out.println("你好,我叫"+name+",今年"+age+"岁了，所在班级："+className+",学号是:"+stuId);
    }
    void playWith(String anotherName){
        System.out.println(name+"正在和"+anotherName+"一起玩");
    }
}
